﻿#ifndef MAINCONTRACTWIDGET_H
#define MAINCONTRACTWIDGET_H

#include <QWidget>
#include <qstandarditemmodel.h>
#include <qabstractitemmodel.h>
#include <string.h>
#include <qtableview.h>
#include <qheaderview.h>
#include <qgridlayout.h>
#include<QEvent>
#include"CtpInterface/ThostFtdcUserApiStruct.h"

class MainContractWidget : public QWidget
{
    Q_OBJECT
public:
    explicit MainContractWidget(QWidget *parent = 0);

    bool eventFilter(QObject *obj, QEvent *event);

signals:
    void SigkeyPressEvent(QKeyEvent*);
public slots:
public:
    void setupModel();
    void setupViews();
    void AddRow(CThostFtdcInstrumentField *pInstrument);

    //void ShowInstrumentMarginRateInfo(IF2UnPacker *lpUnPacker);
    void ShowInstrumentMarginRateInfo();

	double GetPriceStep(QString code);
    double GetOpenRatio(char bs,QString ordertype,QString futucode);
    int    GetAmountPerHand(QString futucode);

public:
    QTableView* tableContract;
    QAbstractItemModel *modelContract;

	QMap<QString,double>  m_MapPriceStep;
    QMap<QString,double>  m_MapAmountPerHand;

    QMap<QString,double>  m_MapBuyTouji;
    QMap<QString,double>  m_MapBuyTaobao;
    QMap<QString,double>  m_MapBuyTaoli;
    QMap<QString,double>  m_MapSellTouji;
    QMap<QString,double>  m_MapSellTaobao;
    QMap<QString,double>  m_MapSellTaoli;

private:
    QGridLayout *MainLayout;
};


#endif // MAINCONTRACTWIDGET_H
